package com.starblink.imgsearch.imgrecognition.ui

import android.view.LayoutInflater
import android.view.ViewGroup
import com.starblink.android.basic.base.fragment.BaseTVMFragment
import com.starblink.android.basic.ext.invisible
import com.starblink.android.basic.util.FlowCountDownTimer
import com.starblink.imgsearch.databinding.FragmentImgRecognitionBinding

/**
 *
 */
class ImgRecognitionFragment : BaseTVMFragment<FragmentImgRecognitionBinding, ImgRecognitionVM>() {

    companion object {
        private const val TAG = "ImgRecognitionFragment"
        fun obtainFragment(): ImgRecognitionFragment {
            return ImgRecognitionFragment()
        }
    }


   private val downTimer = FlowCountDownTimer(time = 3)

//    private lateinit var takePicListener: (() -> Unit)
//    private lateinit var readAlumImageListener: (() -> Unit)
//    private lateinit var switchCameraListener: (() -> Unit)

    override fun getViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragmentImgRecognitionBinding {
        return FragmentImgRecognitionBinding.inflate(inflater, container, false)
    }

    /**
     * 初始化数据
     */
    override fun initData() {
    }

    override fun startObserve() {
    }

    fun startTimerHideTop() {
        downTimer.start(callBack = { }, onFinish = {
            viewBinding.tvTipIcon.invisible()
            viewBinding.tvTip.invisible()
        })
    }

//    fun setTakePicListener(listener: () -> Unit) {
//        this.takePicListener = listener
//    }
//    fun setReadAlumImageListener(listener: () -> Unit) {
//        this.readAlumImageListener = listener
//    }
//    fun setSwitchCameraListener(listener: () -> Unit) {
//        this.switchCameraListener = listener
//    }

    override fun onDestroy() {
        downTimer.cancel()
        super.onDestroy()
    }


    override fun onResume() {
        super.onResume()
    }

}